package com.hongye.house.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.hongye.house.entity.OutdoorImgEntity;
import com.hongye.house.service.OutdoorImgService;
import com.hongye.common.utils.PageUtils;
import com.hongye.common.utils.R;



/**
 * 室外图片表
 *
 * @author lins
 * @email 695565697@qq.com
 * @date 2021-10-14 13:32:23
 */
@RestController
@RequestMapping("house/outdoorimg")
public class OutdoorImgController {
    @Autowired
    private OutdoorImgService outdoorImgService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = outdoorImgService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{outdoorId}")
    public R info(@PathVariable("outdoorId") Integer outdoorId){
		OutdoorImgEntity outdoorImg = outdoorImgService.getById(outdoorId);

        return R.ok().put("outdoorImg", outdoorImg);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody OutdoorImgEntity outdoorImg){
		outdoorImgService.save(outdoorImg);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody OutdoorImgEntity outdoorImg){
		outdoorImgService.updateById(outdoorImg);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] outdoorIds){
		outdoorImgService.removeByIds(Arrays.asList(outdoorIds));

        return R.ok();
    }

}
